CREATE TABLE jms_dm.dm_sqs_loss_type_cnt_dt (
network_code varchar(120) NULL COMMENT "网点code",
first_type_code varchar(120) NULL COMMENT "一级异常类型code",
second_type_code varchar(120) NULL COMMENT "二级异常类型code",
date_time date NULL COMMENT "统计日期 结案时间",
loss_type varchar(120) NULL COMMENT "遗失类型",
network_id varchar(120) NULL COMMENT "网点id",
first_type_id varchar(120) NULL COMMENT "一级异常类型id",
first_type varchar(120) NULL COMMENT "一级异常类型名称(冗余)",
second_type_id varchar(120) NULL COMMENT "二级异常类型id",
second_type varchar(120) NULL COMMENT "二级异常类型名称(冗余)",
waybill_cnt decimal(16, 2) NULL COMMENT "票量",
manage_code varchar(120) NULL COMMENT "大区code",
manage_name varchar(120) NULL COMMENT "大区name",
virt_code varchar(120) NULL COMMENT "虚拟代理区code",
virt_name varchar(120) NULL COMMENT "虚拟代理区name",
financial_center_code varchar(120) NULL COMMENT "代理区code",
financial_center_name varchar(120) NULL COMMENT "代理区名称",
is_org_virt tinyint(4) NULL COMMENT "是否是实际虚拟代理区 1是0否",
provider_id varchar(120) NULL COMMENT "省id",
provider_desc varchar(120) NULL COMMENT "省id",
city_id varchar(120) NULL COMMENT "城市ID",
city_desc varchar(120) NULL COMMENT "城市",
area_id varchar(120) NULL COMMENT "区/县id",
area_desc varchar(120) NULL COMMENT "区/县id",
district_code varchar(120) NULL COMMENT "片区code",
district_name varchar(120) NULL COMMENT "片区name",
network_name varchar(120) NULL COMMENT "网点名称",
network_type int(11) NULL COMMENT "网点类型:1总部,2代理区,3加盟商,4中心,5集散点,6网点"
) ENGINE=OLAP 
DUPLICATE KEY(network_code, first_type_code, second_type_code)
COMMENT "遗失率问题类型统计"
PARTITION BY RANGE(date_time)
   START ("2023-03-02") END ("2023-05-01") EVERY (INTERVAL 1 day))
DISTRIBUTED BY HASH(first_type_code) BUCKETS 4 
PROPERTIES (
"replication_num" = "3",
"dynamic_partition.enable" = "true",
"dynamic_partition.time_unit" = "DAY",
"dynamic_partition.time_zone" = "Asia/Shanghai",
"dynamic_partition.start" = "-180",
"dynamic_partition.end" = "3",
"dynamic_partition.prefix" = "p",
"dynamic_partition.buckets" = "4",
"in_memory" = "false",
"storage_format" = "V2"
);